package com.oron3.bouncer.interaction;




public class MotionEvent extends InteractiveEvent {
	public final static int PAGE_LEFT = -1;
	public final static int PAGE_RIGHT = -2;
	private boolean isPageMoveRequest;
	/**
	 * 
	 * @param movePageRequest either PAGE_LEFT or PAGE_RIGHT
	 */
	public MotionEvent(final InteractionInterpreter interpreter,final int movePageRequest) {
		super(interpreter,movePageRequest, 0);
		isPageMoveRequest=true;
	}
	public MotionEvent(final InteractionInterpreter interpreter,final int x, final int y,final int movex,final int movey) {
		super(interpreter,x, y);
		this.movex=movex;
		this.movey=movey;
	}

	public MotionEvent(final InteractionInterpreter interpreter) {
		super(interpreter);
	}

	private int movex,movey;
	private boolean isRightClick;

	public int getMovex() {
		return movex;
	}

	public void setMovex(final int movex) {
		this.movex = movex;
	}

	public int getMovey() {
		return movey;
	}

	public void setMovey(final int movey) {
		this.movey = movey;
	}
	public boolean isPageLeftReq() {
		return x==PAGE_LEFT && isPageMoveRequest;
	}
	public boolean isPageRightReq() {
		return x==PAGE_RIGHT && isPageMoveRequest;
	}
	public void set(final float x, final float y, final int movex2, final int movey2) {
		this.x = x;
		this.y = y;
		setMovex(movex2);
		setMovey(movey2);
	}
	public void set(final int x, final int y) {
		this.x = x;
		this.y = y;
	}

	public boolean isRightClick() {
		return isRightClick;
	}
	public void setRightClick(final boolean isRightClick) {
		this.isRightClick = isRightClick;
	}
	private float velocity = 0;
	private boolean isVelocitySet;

	public void setVelocity(final float velocityX) {
		isVelocitySet=true;
		velocity=velocityX;
	}
	/**
	 * velocity is set to be unset after call to this method, it will be set to set again whenever setVelocity is called.
	 * @return
	 */
	public float getVelocity() {
		final float res = velocity;
		isVelocitySet=false;
		velocity=0;
		return res;
	}
	public boolean isVelocitySet() {
		return isVelocitySet;
	}

}
